﻿// JScript File
function EmptyFunction(val)
{    
    return val;
}
function EmptyClass()
{
    this.SetValue = EmptyFunction;
    this.GetFormattedValue = EmptyFunction;
    this.SetFormattedValue = EmptyFunction;
    this.GetUnFormattedValue = EmptyFunction;
}

function Required_CheckBoxList_Validate(source,args)
{
    
    var list = document.getElementById(source.ListToValidate);
    if(list == null)
    {
        args.IsValid = false;
        return;
    }
    
    var checkBoxes = list.getElementsByTagName("INPUT");
    for(var i=0; i<checkBoxes.length; i++)
    {
        if(checkBoxes[i].type=="checkbox" && checkBoxes[i].checked)
        {
           args.IsValid = true;
           return; 
        }
    }
    
    //no selected item found. 
    args.IsValid = false;
}

//*****<GetValue Methods>
function GetTextValue()
{
    var val;
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;
    var formattingObject = this.FormattingObject;

    
    val = currentCtrl.value;
    if(inputCtrl != null)
    {
        formattingObject.SetFormattedValue(inputCtrl.value);
        val= formattingObject.GetUnFormattedValue(inputCtrl.value);
    }
    return val;
    
}

function GetCheckBoxValue()
{
    var val;
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;
    var formattingObject = this.FormattingObject;

    
    val = (currentCtrl.value || currentCtrl.value == "true")?
        true: false;
    
    if(inputCtrl != null)
    {
       val = inputCtrl.checked;
    }
    
    return val;
    
}
function getDateValue()
{
    var txtVal = this.GetValue();
    return GetDateObject(txtVal,DATE_FORMAT);
}


function GetCheckListValue()
{
    var val;
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;

    
    val = currentCtrl.value;
    if(inputCtrl != null)
    {
        var qoma = "";
        val="";
        for(var i=0; i<=this.Values.length; i++)
        {
            var valsItem = this.Values[i];
            var suffix = this.CheckBoxIdsSuffixWithValues[valsItem];
            var checkBox = document.getElementById(inputCtrl.id + suffix);
           if(checkBox != null && checkBox.checked)
           {
                val += qoma + valsItem;
                qoma = ",";
           }

        }  
    }
    return val;
    
}

//*****</GetValue Methods>


//*****<SetValue Methods>

function setConversionRate(rate)
{
   val = this.GetValue();
   this.RateCtrl.Value=rate;
   this.FormattingObject.Rate=rate;
   this.SetValue(val);
}

function setDateValue(date)
{
    var txtVal = DATE_FORMAT;
    txtVal= txtVal.replace("yyyy",date.getFullYear());
    txtVal= txtVal.replace("mm",date.getMonth()+1);
    txtVal= txtVal.replace("MM",date.getMonth()+1);
    txtVal= txtVal.replace("dd",date.getDate());
    
    this.SetValue(txtVal);
}

function SetCheckListValue(val)
{
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;
    
    //this method currently will work as readonly.
    //means we will change current value only in the case when 
    //inputCtrl will be defined
    
    if(inputCtrl != null)
    {
        //first reset
        ResetCheckBoxList(inputCtrl.id);
        currentCtrl.value=val;
        var vals = val.split(',');
        for(var i=0; i<vals.length; i++)
        {
            if(this.CheckBoxIdsSuffixWithValues[vals[i]] != null)
            {
               var checkBox = document.getElementById(inputCtrl.id + this.CheckBoxIdsSuffixWithValues[vals[i]]);
               if(checkBox != null)
               {
                    checkBox.checked = true;
               }
            }
        }
        
    }    
     
}
function SetComboValue(val)
{
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;
    
    currentCtrl.value=val;
    if(inputCtrl != null)
    {
        inputCtrl.value=val;
        if(inputCtrl.selectedIndex == -1)
        {
            currentCtrl.value="";
            if(val == "") //want to reset.
            {
               //select first index.
               inputCtrl.selectedIndex == 0;
            }
        }
    }    
    else if(displayCtrl != null)
    {
        var text = "";
        if(this.DisplayTextList != null && this.DisplayTextList[val] != null)
        {
            text = this.DisplayTextList[val];
        }
        else
        {
            currentCtrl.value="";
        }
        displayCtrl.innerHTML = text;
    }    
   
}
function SetTextValue(val)
{
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;
    var formattingObject = this.FormattingObject;
    
    currentCtrl.value=val;
    formattingObject.SetValue(val);
    
    
    if(inputCtrl != null)
    {
        if(val == '')
        {
            inputCtrl.value = '';    
        }
        else
        {
            inputCtrl.value=formattingObject.GetUnFormattedValue(val);
        }    
    }
    else if(displayCtrl != null && inputCtrl.value != '')
    {
        if(val == '')
        {
            displayCtrl.value = '';    
        }
        else
        {
            displayCtrl.innerHTML= formattingObject.GetFormattedValue(val); 
        }
    }
}

function SetComboTextValue(val)
{
    //first reset this value which will avoid to postback untill response comes
    //from the server for this calling of service.
    this.IsValueFound = false
    
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;
    
    currentCtrl.value=val;
    if(inputCtrl != null)
    {
        inputCtrl.value=val;
    }
    EXtremecode.WebServices.AWWebService.GetFieldValues_WithFilter
        (this.EntityName,this.FieldNames,this.Key,val,this.WhereClause,
        this.SucceededCallback,this.ErrorCallback);
	            

    
}

function PopulateCombo(combo,rows)
{
    if(combo.InputCtrl != null)
    {
        //remove combo items
        combo.InputCtrl.length = 1;
        
        
        //add data into combo
        if(rows != null && rows.length > 0 )
        {
             for(var i=0; i<rows.length; i++)
             {
                var  displayString = combo.StringFromat.Format(rows[i]);
                var value = rows[i][0];
                var option = new Option(displayString,value);
                combo.InputCtrl.add(option);
             }           
        }
        combo.ResetValue();
        
    }
    
}

function RepopulateComboAjax(referencedValue)
{
    if(referencedValue == null || referencedValue == "")
    {
        //clear combo.
        this.InputCtrl.length = 1;
        return;
    }
    
    
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;
    
        
    
    EXtremecode.WebServices.AWWebService.GetListOfFieldValues_WithFilter
        (this.EntityName,this.Key + ',' + this.FieldNames,this.ReferencedKey,referencedValue,this.WhereClause,
        this.SucceededCallback,this.ErrorCallback);
	            
}

function ValidateDuplicate()
{
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;
    
    if(this.GetValue() == '' || this.GetValue() == originalCtrl.value)
    {
        this.DuplicateStatusCtrl.value = "false";
        return;
    }
    
    this.waitingForServiceResponse = false
    this.DuplicateStatusCtrl.value = "true";
   
    EXtremecode.WebServices.AWWebService.IsDuplicate
        (this.EntityNameDuplicateCheck,this.FieldNameDuplicateCheck + "= N'" + this.GetValue() + "'",
        DuplicateSucceededCallback,DuplicateErrorCallback,this);
	            

    
}

function DuplicateSucceededCallback(duplicate,callerCtrl)
{
   if(duplicate)
   {
        callerCtrl.DuplicateStatusCtrl.value= "true";
   }
   else
   {
        callerCtrl.DuplicateStatusCtrl.value = "false"
   }
}
         
function DuplicateErrorCallback(error,callerCtrl)
{
    callerCtrl.DuplicateStatusCtrl.value= "true";
}

function Validate_Duplicate(source,args)
{
	var control = document.getElementById(source.ControlId);
	if (control == null || (control.DuplicateStatusCtrl.value == "true" && control.GetValue() != ''))
	{
		args.IsValid = false;
	}
	else
	{
	    args.IsValid = true;
	}
}

function Validate_ValueFound(source,args)
{
	var control = document.getElementById(source.ControlId);
	if (control != null && control.IsValueFound == true)
	{
		args.IsValid = true;
	}
	else
	{
	    args.IsValid = false;
	}
}
function succeededCallback(info)
{
    alert(info);
}
         
function errorCallback(error)
{
    alert(error._message);
}

function SetCheckBoxValue(val)
{
    if(val == "true" || val == true)
    {
        val = true;
    }
    else
    {
        val = false;
    }
    
    var originalCtrl = this.OriginalCtrl;
    var currentCtrl=this;
    var inputCtrl=this.InputCtrl;
    var displayCtrl=this.DisplayCtrl;
    
    currentCtrl.value = val;
    if(inputCtrl != null)
    {
        inputCtrl.checked=val;
    }
    else if(displayCtrl != null)
    {
        if(val)
        {
            displayCtrl.src= this.CheckedImage.src; 
        }
        else
        {
            displayCtrl.src= this.UncheckedImage.src; 
        }
    }
}

function resetValue()
{
    if(this.InputCtrl != null)
    {
        this.SetValue("");
    }
}
//*****</SetValue Methods>

//*****<Reset Methods>
function ResetCheckBoxList(controlId)
{
    var control = document.getElementById(controlId);
    if(control != null)
    {
        var checkBoxes = control.getElementsByTagName("INPUT");
        for(var i=0; i<checkBoxes.length; i++)
        {
            if(checkBoxes[i].type=="checkbox")
            {
               checkBoxes[i].checked = false;
            }
        }
    }
}

function ResetTextBox(controlId)
{
   var control = document.getElementById(controlId);
   if(control != null)
   {
        control.value='';
   }
}

function ResetCombo(controlId)
{
   var control = document.getElementById(controlId);
   if(control != null && control.selectedIndex != null && control.selectedIndex > 0)
   {
         control.selectedIndex = 0;
   }
}

function ResetCheckBox(controlId)
{
   var control = document.getElementById(controlId);
   if(control != null)
   {
        control.checked=false;
   }
}




function ResetControl(controlId,func)
{
    if(func != null && controlId != null)
    {
        func(controlId);
    }
}
//****</Reset Methods>



//****<Check box selection methods>
function InTableCheckAll(checkBoxAll,containingTable)
{
    
    var checkBoxes = containingTable.getElementsByTagName("INPUT");
    for(var i=0; i<checkBoxes.length; i++)
    {
        
        if(checkBoxes[i].type == "checkbox" && 
            checkBoxes[i].attributes["selectCheckBox"] != null && 
            checkBoxes[i].attributes["selectCheckBox"].nodeValue=="true")
        {
            checkBoxes[i].checked = checkBoxAll.checked;
        }
    } 
    ApplySelectRowsStyle(containingTable);  
}
function InTableCheckAnyCheckboxSelected(containingTable)
{
    
    var checkBoxes = containingTable.getElementsByTagName("INPUT");
    var checkBoxSelected = false
    for(var i=0; i<checkBoxes.length; i++)
    {
        
        if(checkBoxes[i].type == "checkbox" && 
            checkBoxes[i].attributes["selectCheckBox"] != null && 
            checkBoxes[i].attributes["selectCheckBox"].nodeValue=="true" &&
            checkBoxes[i].checked)
        {
            
            checkBoxSelected = true;  
            break;
        }
    } 
    return checkBoxSelected;   
}
function InTableApplyCheckboxSelectionChecks(containingTable)
{
    if(!InTableCheckAnyCheckboxSelected(containingTable))
    {
        alert(MESSAGE_NO_ROW_SELECTED)
        return false;
    } 
    return true;
}
function GetSelectedCheckBoxTagValues(containingTable,tagName)
{
    
    var checkBoxes = containingTable.getElementsByTagName("INPUT");
    var valueIndex = 0;
    var values = new Array();
    for(var i=0; i<checkBoxes.length; i++)
    {
        
        if(checkBoxes[i].type == "checkbox" && 
            checkBoxes[i].checked &&
            checkBoxes[i].attributes["selectCheckBox"] != null && 
            checkBoxes[i].attributes["selectCheckBox"].nodeValue=="true" &&
            checkBoxes[i].attributes[tagName] != null)
        {
             values[valueIndex] = checkBoxes[i].attributes[tagName].nodeValue;
             valueIndex++;
        }
    } 
    return values;
}
function ApplySelectRowsStyle(table)
{
    if(table == null)return;
    for(var rowIndex=0; rowIndex<table.rows.length; rowIndex++)
    {
        var row = table.rows[rowIndex];
        var checkBoxes = row.getElementsByTagName("INPUT");
        for(var i=0; i<checkBoxes.length; i++)
        {
            if(checkBoxes[i].type == "checkbox" && 
            checkBoxes[i].attributes["selectCheckBox"] != null && 
            checkBoxes[i].attributes["selectCheckBox"].nodeValue=="true")
            {
                row.checked = checkBoxes[i].checked;
                ApplySelectRowStyle(row,checkBoxes[i].checked);
            }
        }
    }
   
}

function ApplySelectRowStyle(row,isSelected,selectedStyle)
{
        
    if(selectedStyle == null)
    {
        //default style
        selectedStyle ="awTableSelectRow";
    }
    
  
    if(isSelected)
    {
        //save current style;
        if(row.className != selectedStyle)
        {
            //it may possible, same style apply more than one time continuesly.
            // which can disturb the track of ClassName so need to add this check
            row.oldClassName = row.className;
        }
    
        row.className = selectedStyle;
    }
    else if (!row.checked)
    {
        if(row.oldClassName != null)
        {
            row.className = row.oldClassName;
        }
    }
 
}

//[OBSOLETE] now we have found the technique how to handle events in fire fox. 
function AssignCheckAllFuuctionToCheckBoxes(checkBoxContainer)
{
    if(checkBoxContainer.AssignmentCompleted)
    {
        return;
    }
    var checkBoxes = checkBoxContainer.getElementsByTagName("INPUT");
    for(var i=0; i<checkBoxes.length; i++)
    {
        
        if(checkBoxes[i].type == "checkbox") 
        {
            checkBoxes[i].onclick = checkBoxContainer.onclick;
        }
    }
    checkBoxContainer.onclick=null; 
    checkBoxContainer.AssignmentCompleted=true;
   
}
function InTreeViewCheckAll(evt)
{
    //for make it in firefox usable. 
    evt = (evt) ? evt : ((window.event) ? event : null);
        var obj = (evt.target) ? evt.target : 
          ((evt.srcElement) ? evt.srcElement : null);

    var treeNodeFound = false;
    var checkedState;
   
    if (obj.tagName == "INPUT" && obj.type == "checkbox")
    {
        var treeNode = obj;
        checkedState = treeNode.checked;
        do
        {
            obj = obj.parentNode;
        } while (obj.tagName != "TABLE")
        
        //obj is the table container of checkbox.
        //and table is contained by div e.g [obj.parentElement]  currentDiv
        //this div contains other divs, one of them contains child elements.  childDiv
 
        var currentDiv=obj.parentNode;
        var childDiv=null;
        // get child div
        for(var i=0; i<currentDiv.childNodes.length; i++)
        {
            if(currentDiv.childNodes[i].tagName == "DIV")
            {
                var strCheckBox="CheckBox";
                var commonId=treeNode.id.substring(0,treeNode.id.length-strCheckBox.length);
                
                //if div's id started with commonId then it would be the childDiv  
                if(currentDiv.childNodes[i].id.match(commonId))
                {
                    childDiv = currentDiv.childNodes[i];
                    break;
                }
            }
        }
            
        //change checked state of childs 
        if(childDiv != null)
        {
            var checkBoxes = childDiv.getElementsByTagName("INPUT");
            for(var i=0; i<checkBoxes.length; i++)
            {
                if(checkBoxes[i].type=="checkbox")
                {
                    checkBoxes[i].checked = checkedState;
                   // alert (checkBoxes[i].title);
                }
            }
        } 
        
       //if checkedState is true then check its parents also.
       //if checkState is false and its siblings state is also false then uncheck its parent.
       var div=GetParentDivOfTreeNode(checkedState,treeNode);
       var strCheckBox="CheckBox";
       var strNodes="Nodes"
       while(div != null)
       {
           var commonId=div.id.substring(0,div.id.length-strNodes.length);
           var parentCheckBox= document.getElementById(commonId + strCheckBox);
           if(parentCheckBox != null)
           {
                parentCheckBox.checked = checkedState; 
                div = GetParentDivOfTreeNode(checkedState,parentCheckBox);
           }
           else
           {
                break;
           }
           
       }  

        
        
    }
}



function GetParentDivOfTreeNode(checkedState,checkBox)
{

    //get div
    var obj=checkBox;
    var div=null;
    do
    {
            obj = obj.parentNode;
    } while (obj.tagName != "TABLE")
    
    if(obj.tagName == "TABLE")
    {
       div=obj.parentNode;
    }
    if(checkedState==true)
    {
        return div;
    }
    else
    {
        // if all siblings are unchecked then pass div otherwise pass null.

        var allUnchecked=true;
        for(var i=0; i<div.childNodes.length; i++)
        {
            if(div.childNodes[i].tagName=="TABLE")
            {
                var tbl=div.childNodes[i];
                var checkBoxes = tbl.getElementsByTagName("INPUT");
                for(var j=0; j<checkBoxes.length; j++)
                {
                    if(checkBoxes[j].type=="checkbox" && checkBoxes[j].checked)
                    {
                        
                        allUnchecked=false;
                        break;
                    }
                }
                if(!allUnchecked)
                {
                    break;
                }
            } 
            
        }

        if(allUnchecked)
        {
            return div;
        }
        else
        {
            return null;
        }
    }
    
    
   
    
}
//****</Check box seletetion methods> 


//****<Date Functions> 
function ValidateDate(dateString,dateFormat)
{
    var date = GetDateObject(dateString,dateFormat);
    
    if(date != null)
    {
        return true;
    }
    else
    {
        return false;
    }
   
}


function GetDateObject(dateString,dateFormat)
{
    //dateFormat may be like dd/mm/yyyy, we assuming only date portion so ignoring time.
    
    var delimChar = (dateFormat.indexOf("/") != -1) ? "/" : "-";

    var formatSplit= dateFormat.split(delimChar);
    var dateSplit= dateString.split(delimChar); 
     
    var day,mo,yr
    if(dateSplit.length == formatSplit.length &&
     dateSplit.length == 3)
    {
      
       for(var i=0; i<dateSplit.length; i++)
       { 
           var datePart=dateSplit[i];
           var formatPart=formatSplit[i];
           
           //get day **dd
           if(formatPart == "dd")
           {
                var re =   /\d{2}/;
                
                //parsing check
                if(!re.test(datePart))
                {
                    return null;
                }
               
                var day =  parseInt(eval(datePart));
                 
                
                //basic check
                if(day>31 || day<1)
                {
                    return null;
                }
           }
           
           //get month **mm
           else if(formatPart == "mm" || formatPart == "MM")
           {
                var re =   /\d{2}/;
                
                //parsing check
                if(!re.test(datePart))
                {
                    return null;
                }
                
                var mo =  parseInt(eval(datePart));
                
                //basic check
                if(mo>12 || mo<1)
                {
                    return null;
                }
           }
           
           //get month **yyyy
           else if(formatPart == "yyyy")
           {
                var re =   /\d{4}/;
                
                //parsing check
                if(!re.test(datePart))
                {
                    return null;
                }
                var yr =  parseInt(eval(datePart));
                
                
           }
           else
           {
              return null;
           }
       }
       
       
       //day portion need to further check.
       var maxDay = 31;
       if (mo == 4 || mo == 6 || mo == 9 || mo == 11)
       {
		    maxDay = 30;
	   }
	   else if (mo == 2) 
	   {
		    if (yr % 4 > 0)
		    {
			    maxDay =28;
		    }
		    else if ((yr % 100 == 0) && (yr % 400 > 0))
		    {
			    maxDay = 28;
		    }
		    else
		    {
			    maxDay = 29;
		    }
	   }
	   
	   if(day > maxDay )
	   {
	      return null;
	   }
	   
	   //date have been validated so return date object.
	  var date = new Date(yr, mo-1, day);
	  return date;
    }
    else
    {
        return null;
    }
    
    
}
function Validator_CheckDate(source, args)
{
    
    var dateString = args.Value;
    if(ValidateDate(dateString,DATE_FORMAT))
    {
        args.IsValid =  true;
    }
    else
    {
        args.IsValid =  false;
    }
}

//****</Date Functions> 

//****<string Functions>
function GetFormattedString()
{
   
   var str = this;
   var index=0;
   for(var i=0; i<GetFormattedString.arguments.length; i++)
   {
        var arg=GetFormattedString.arguments[i];
        var expression;
        var re
        if(typeof arg == "object")
        {
            for(var j=0; j < arg.length; j++)
            {
                expression = "\\{" + (index) + "\\}";
                re = new RegExp(expression , "g");
                str = str.replace(re, arg[j]);
                index++;
            }
        }
        else if(typeof arg == "string")
        {
            expression = "\\{" + (index) + "\\}";
            re = new RegExp(expression , "g");
            str = str.replace(re, arg);
            index++;
        }
   } 
   return str;
}

String.prototype.Format= GetFormattedString;
//****</string Functions>


function OpenPopup(url,width,height,pageId
    ,returnKey,openerHandler,groupFilterFields,groupFilterValues,isMultiRowSelectionAllowed
    , resizable, scrollbars,status, top, left)
{
   

   if(resizable == null || (resizable == "" && resizable != false) || resizable == true || resizable == "yes" )
   {
        resizable = "yes";
   }
   else
   {
        
        resizable = "no";
   }
   
   
    if(status == null || (status == "" && status != false) || status == true  || status == "yes" )
   {
        status = "yes";
   }
   else
   {
        status = "no";
   }
   
   
   if(scrollbars == null || (scrollbars == "" && scrollbars != false) || scrollbars == true  || scrollbars == "yes")
   {
        scrollbars = "yes";
   }
   else
   {
        scrollbars = "no";
   }
   
   
   if(top == null || top == "")
   {
        //default top.
        top=0;
   }
   
   if(left == null || left == "")
   {
        //default left.
        left=0;
   }
   
   
   if(pageId == null || pageId == "")
   {
        //default id.
        pageId="popup";
   }
   
   if(width == null)
   {
       //default width.
       width = 800;  
   }
   
   if(height == null)
   {
       //default height.
       height = 400;  
   }
   
   //modify url.
   url += ((url.indexOf("?")>=0)? "&": "?") + "IsPopup=1";
   if(returnKey !=null && returnKey != "")
   {
       url += "&ReturnKey=" + returnKey;
   }
   if(isMultiRowSelectionAllowed !=null && isMultiRowSelectionAllowed != "")
   {
       url += "&MultiRowSelectionAllowed=" + isMultiRowSelectionAllowed;
   }
   if(openerHandler !=null && openerHandler != "")
   {
       url += "&OpenerHandler=" + openerHandler;
   }
   if(groupFilterFields !=null && groupFilterValues != null && groupFilterFields != "" && groupFilterValues != "")
   {
       url += "&GroupFilterFields=" + groupFilterFields + "&GroupFilterValues=" + groupFilterValues;
   }
   url += "&Filter=1";
   window.open(url, pageId ,"width=" + width + ",height=" + height + ",status=" + status + ",resizable="+ resizable +",modal=1,alwaysRaised=true,scrollbars="+ scrollbars +",top="+ top +",left=" + left); 
  
}

function ValidateStartEndDate(source,args)
			{
			    
			    var ctrlEndDate =  document.getElementById(source.attributes["CtrlEndDateID"].nodeValue);
			    var ctrlStartDate =document.getElementById(source.attributes["CtrlStartDateID"].nodeValue);
			    
			    var endDate = ctrlEndDate.GetDateValue();
			    var startDate = ctrlStartDate.GetDateValue();
			    
			    if(endDate != null && startDate !=null && startDate > endDate)
			    {
			        args.IsValid = false;
			        //CONFIRMATION_DISPLAY=false;
			    }
			    else
			    {
			        args.IsValid = true;
			        //CONFIRMATION_DISPLAY=true
			    }
			}


function ApplyTransparencyOnImages()
{
    var images = document.getElementsByTagName("IMG");
    for(var i=0; i<images.length; i++)
    {
        
        if((images[i].attributes["IsTransparent"] != null && 
            images[i].attributes["IsTransparent"].nodeValue=="true"))
        {
            ApplyTransparencyOnImage(images[i]);
        }
    }
    
    var inputImages = document.getElementsByTagName("INPUT");
    for(var i=0; i<inputImages.length; i++)
    {
        if(inputImages[i].type=="image" &&
        (inputImages[i].attributes["IsTransparent"] != null && 
            inputImages[i].attributes["IsTransparent"].nodeValue=="true"))
        {
           ApplyTransparencyOnImage(inputImages[i]);
           
        }
    }
}
function ApplyTransparencyOnImage(myImage)
{


	var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	var imgTitle = (myImage.title) ? "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	var imgStyle = "display:inline-block;" + myImage.style.cssText
	var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + 
                  "width:" + myImage.width+ "px; height:" + myImage.height+ "px;" + 
                  imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	myImage.outerHTML = strNewHTML
	//alert(strNewHTML);
}

function ApplyTransparencyOn(myImage)
{


	var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	var imgTitle = (myImage.title) ? "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	var imgStyle = "display:inline-block;" + myImage.style.cssText
	var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + 
                  "width:" + myImage.width+ "px; height:" + myImage.height+ "px;" + 
                  imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	myImage.outerHTML = strNewHTML
	//alert(strNewHTML);
}